﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using YakShaver.WCSF.BuildManager.Views;
using Microsoft.Practices.ObjectBuilder;
using YakShaver.WCSF.BuildManager.Interface.BusinessEntities;
using YakShaver.WCSF.BuildManager.Interface.Services;
using System.Collections.Generic;
namespace YakShaver.WCSF.BuildManager.Views
{
    public partial class BuildManagerDefault : Microsoft.Practices.CompositeWeb.Web.UI.Page, IDefaultView
    {
        private DefaultViewPresenter _presenter;
        private IList<IProject> _builds;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
            }
            this._presenter.OnViewLoaded();
        }

        public void SetBuilds(IList<IProject> builds)
        {
            _builds = builds;
            //rebind the grid
            gvBuilds.DataSource = _builds;
            gvBuilds.DataBind();
        }
        [CreateNew]
        public DefaultViewPresenter Presenter
        {
            set
            {
                this._presenter = value;
                this._presenter.View = this;
            }
        }
    }
}
